package com.alibaba.sample.kantiezi.web.home.module.action;


import com.alibaba.sample.kantiezi.web.home.module.screen.Welcome;
import com.alibaba.service.form.Form;
import com.alibaba.service.form.FormService;
import com.alibaba.service.form.Group;
import com.alibaba.service.template.TemplateContext;
import com.alibaba.turbine.module.action.TemplateAction;
import com.alibaba.turbine.service.rundata.RunData;
import com.alibaba.webx.WebxException;

public abstract class UserWelcomeAction extends TemplateAction{
	 
	  protected abstract FormService getFormService();
	
	  public void doWel(RunData rundata, TemplateContext context)
	            throws WebxException { 
		Form form = getFormService().getForm(rundata);
        if (form.isValid()) {
            Group    group = form.getGroup("welcome");
            Welcome wel  = new Welcome();
            String usernName =  (String)group.getField("name").getStringValue();
            System.out.print(usernName);
            context.put("name",usernName);
            context.put("customerName", usernName);
            rundata.setRedirectTarget("viewCustomer.vm");
           
        	}
	    }
}
